package com.biz.primus.app.rest.feign;

import com.biz.primus.app.rest.degraded.DegradedGeoFeignClient;
import com.biz.primus.model.geo.vo.AreaResponseVo;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * GeoFeignClient
 *
 * @author JKLiues
 * @date 2017年11月14日
 */
@FeignClient(qualifier = "geoFeignClient", name = "service-geo", fallback = DegradedGeoFeignClient.class)
public interface GeoFeignClient {
    /**
     * 返回中国所有省的列表
     *
     * @return List<AreaResponseVo>
     */
    @GetMapping("soa/geoService/findAllProvince")
    List<AreaResponseVo> findAllProvince();

    /**
     * 根据省id 获取该省所有市的 volist
     *
     * @param provinceId 省ID
     * @return List<AreaResponseVo>
     */
    @SuppressWarnings("unchecked")
    @GetMapping("soa/geoService/findCitiesByProvinceId")
    List<AreaResponseVo> findCitiesByProvinceId(@RequestParam("provinceId") Long provinceId);

    /**
     * 根据市id获取该市所有的区
     *
     * @param cityId 市ID
     * @return List<AreaResponseVo>
     */
    @GetMapping("soa/geoService/findDistrictsByCityId")
    List<AreaResponseVo> findDistrictsByCityId(@RequestParam("cityId") Long cityId);
}